package com.xiyu.service.controller.admin.nurse;
import com.xiyu.service.vo.nurse.nurseItem.NurseItemListQueryOutput;
import com.xiyu.service.vo.nurse.nurseItem.NurseItemGetOutput;
import com.xiyu.service.vo.nurse.nurseItem.NurseItemUpdateInput;
import com.xiyu.service.vo.nurse.nurseItem.NurseItemQueryInput;
import com.xiyu.service.vo.nurse.nurseItem.NurseItemQueryOutput;
import com.xiyu.service.vo.nurse.nurseItem.NurseItemCreateInput;
import org.springframework.web.bind.annotation.*;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import jakarta.validation.constraints.*;
import jakarta.validation.*;
import jakarta.servlet.http.*;
import java.util.*;

import com.xiyu.service.framework.web.web.core.pojo.PageResult;
import com.xiyu.service.framework.web.web.core.pojo.CommonResult;
import static com.xiyu.service.framework.web.web.core.pojo.CommonResult.success;

import com.xiyu.service.framework.excel.core.util.ExcelUtils;

import com.xiyu.service.framework.operateLog.core.annotations.OperateLog;
import static com.xiyu.service.framework.operateLog.core.enums.OperateTypeEnum.*;

import com.xiyu.service.service.nurse.NurseItemService;

@Tag(name = "护理项目")
@RestController
@RequestMapping("/nurse/nurse-item")
@Validated
public class NurseItemController {

    @Resource
    private NurseItemService nurseItemService;

    @PostMapping("/create")
    @Operation(summary = "创建护理项目")
    @PreAuthorize("@ss.hasPermission('nurse:item:create')")
    public CommonResult<Long> create(@Valid @RequestBody NurseItemCreateInput inputVO) {
        return success(nurseItemService.create(inputVO));
    }

    @GetMapping("/query")
    @Operation(summary = "分页查询护理项目")
    @PreAuthorize("@ss.hasPermission('nurse:item:query')")
    public CommonResult<PageResult<NurseItemQueryOutput>> query(@Valid NurseItemQueryInput inputVO) {
        return success(nurseItemService.query(inputVO));
    }

    @PutMapping("/update")
    @Operation(summary = "修改护理项目")
    @PreAuthorize("@ss.hasPermission('nurse:item:update')")
    public CommonResult<Boolean> update(@Valid @RequestBody NurseItemUpdateInput inputVO) {
        return success(nurseItemService.update(inputVO));
    }

    @DeleteMapping("/deleted")
    @Operation(summary = "删除护理项目")
    @PreAuthorize("@ss.hasPermission('nurse:item:deleted')")
    @Parameter(name = "id", description = "主键ID", example = "")
    public CommonResult<Boolean> deleted(@RequestParam("id") Long id) {
        return success(nurseItemService.deleted(id));
    }

    @GetMapping("/get")
    @Operation(summary = "获取单个护理项目")
    @Parameter(name = "id", description = "主键ID", example = "")
    public CommonResult<NurseItemGetOutput> get(@RequestParam("id") Long id) {
        return success(nurseItemService.get(id));
    }

    @GetMapping("/list-query")
    @Operation(summary = "查询护理项目")
    public CommonResult<List<NurseItemListQueryOutput>> listQuery() {
        return success(nurseItemService.listQuery());
    }
}
